/**
 * 
 */
package com.mes.check.domain;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;
import com.mes.task.domain.OperationTask;
import com.mes.basicdata.domain.Dept;
import com.mes.basicdata.domain.Employee;
import com.mes.basicdata.domain.Partner;

/**
 * <p>
 * 报废单表头信息
 * </p>
 */
@Entity()
@Table(name = "M_REJECTHEADER")
@BatchSize(size=20)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Reject extends BasicModel implements java.io.Serializable {
	
	public static final int REJECT_BILLSTATE_CREATED = 0; //　已创建
	public static final int REJECT_BILLSTATE_UNCLOSED = 9; // 未结案
	public static final int REJECT_BILLSTATE_CLOSED = 10; // 已结案
	
	//废单编号
	@Id
	@GenericGenerator(name = "rejectUid", strategy = "assigned")
	@Column(name="REJECTUID")
	protected String rejectUid;
	
	//不合格品审理编号
	@Column(name="DEFECTJUDGEUID",length=50)
	protected String defectJudgeUid;
	//不合格品审理单表头
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="DEFECTJUDGEUID",insertable=false,updatable=false)
	protected DefectJudge defectJudge;
	
	//报废品编号
	@Column(name="REJECTID",length=50)
	protected String rejectId;
	
	//表单号
	@Column(name="BILLNUMBER",length=50)
	protected String billNumber;
	
	//任务编号
	@Column(name="TASKUID",length=50)
	protected String taskUid;
	//任务操作
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="TASKUID",insertable=false,updatable=false)
	protected OperationTask operationTask;
	
//	//值班员编号
//	@Column(name="DUTIER",length=50)
//	protected String dutierUid;
//	//值班员
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="DUTIER",insertable=false,updatable=false)
//	protected Employee dutier;
	
//	//值班部门编号
//	@Column(name="DUTYDEPTID",length=50)
//	protected String dutyDeptUid;
//	//值班部门
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="DUTYDEPTID",insertable=false,updatable=false)
//	protected Dept dutyDept;
	
	//报废品数量
	@Column(name="REJECTQTY",length=50)
	protected Float rejectQty;
	
//	//检验管理员编号
//	@Column(name="CHECKMANAGER",length=50)
//	protected String checkManagerUid;
//	//检验管理员
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="CHECKMANAGER",insertable=false,updatable=false)
//	protected Employee checkManager;
	
//	//值班部门管理员编号
//	@Column(name="DUTYDEPTMANAGER",length=50)
//	protected String dutyDeptManagerUid;
//	//值班部门管理员
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="DUTYDEPTMANAGER",insertable=false,updatable=false)
//	protected Employee dutyDeptManager;
	
	//损耗时间
	@Column(name="WASTEHOUR",length=50)
	protected Integer wasteHour;
	
	//损耗物料金额
	@Column(name="WASTEMATERIALMONEY",length=50)
	protected Integer wasteMaterialMoney;
	
	//损耗工作金额
	@Column(name="WASTEWORKMONEY",length=50)
	protected Integer wasteWorkMoney;
	
//	//客户编号
//	@Column(name="CUSTOMERID",length=50)
//	protected String customerUid;
//	//客户
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="CUSTOMERID",insertable=false,updatable=false)
//	protected Partner customer;
	
	//不合格原因
	@Column(name="DEFECTREASON",length=50)
	protected String defectReason;
	
	//检验员编号
	@Column(name="CHECKER",length=50)
	protected String checkerUid;
	//检验员名
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CHECKER",insertable=false,updatable=false)
	protected Employee checker;
	
	//报废状态
	@Column(name="REJECTSTATE",length=50)
	protected Integer rejectBillState;
	
	//是否成批
	@Column(name="ISINBULK",length=50)
	protected Integer isInBulk;
	
	//部门编号
	@Column(name="DEPTID",length=50)
	protected String deptUid;
	//部门名称
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="DEPTID",insertable=false,updatable=false)
	protected Dept dept;
	
	//相关文档
	@Column(name="ATTATCHREF",length=50)
	protected String attatchRef;
	
	//检验时间
	@Column(name="CHECKTIME",length=50)
	protected Date checkTime;
	
//	//分管理员编号
//	@Column(name="SEGEMENTMANAGER",length=50)
//	protected String segementManagerUid;
//	//分管理员
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="SEGEMENTMANAGER",insertable=false,updatable=false)
//	protected Employee segementManager;
	
	//是否有效状态（默认为1）
	@Column(name="ISINEFFECT",length=50)
	protected Boolean isInEffect;
	
//	//批复状态
//	@Column(name="APPROVESTATE",length=50)
//	protected Integer approveState;
//	
//	//批复人员编号
//	@Column(name="APPROVEPERSON",length=50)
//	protected String approvePersonUid;
//	//批复人员
//	@ForeignKey(name="null")
//	@ManyToOne(fetch=FetchType.LAZY)
//	@JoinColumn(name="APPROVEPERSON",insertable=false,updatable=false)
//	protected Employee approvePerson;
	
	//物料系统编号
	@Column(name="MATERIALUSN",length=50)
	protected String materialUid;

	//累计工时
	@Column(name="TOTAL_TASKWORK")
	protected Float totalTaskWork;
		
	//每小时费用率
	@Column(name="FEE_PER_HOUR")
	protected Float feePerHour;
	
	//单件材料费
	@Column(name="MATERIAL_FEE_PER_PIECE")
	protected Float materialFeePerPiece;
	
	//损失半成品费
	@Column(name="LOSE_SEMIFINISHED_PRODUCT_FEE")
	protected Float loseSemifinishedProductFee;
	
	//总损失金额
	@Column(name="TOTAL_LOSE_AMOUNT")
	protected Float totalLoseAmount;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "reject")
	public List<RejectDetail> rejectDetails;
	
	
	public Reject() {
	}

	public String getRejectUid() {
		return rejectUid;
	}

	public void setRejectUid(String rejectUid) {
		this.rejectUid = rejectUid;
	}
	public String getDefectJudgeUid() {
		return defectJudgeUid;
	}

	public void setDefectJudgeUid(String defectJudgeUid) {
		this.defectJudgeUid = defectJudgeUid;
	}

	public DefectJudge getDefectJudge() {
		return defectJudge ;
	}

	public void setDefectJudge(DefectJudge defectJudge) {
		this.defectJudge = defectJudge;
	}

	public String getRejectId() {
		return rejectId;
	}

	public void setRejectId(String rejectId) {
		this.rejectId = rejectId;
	}

	public String getBillNumber() {
		return billNumber;
	}

	public void setBillNumber(String billNumber) {
		this.billNumber = billNumber;
	}

	public Employee getCreator() {
		return creator;
	}

	public void setCreator(Employee creator) {
		this.creator = creator;
	}

	public String getTaskUid() {
		return taskUid;
	}

	public void setTaskUid(String taskUid) {
		this.taskUid = taskUid;
	}

	public OperationTask getOperationTask() {
		return operationTask;
	}

	public void setOperationTask(OperationTask operationTask) {
		this.operationTask = operationTask;
	}

	public Float getRejectQty() {
		return rejectQty;
	}

	public void setRejectQty(Float rejectQty) {
		this.rejectQty = rejectQty;
	}

	public Integer getWasteHour() {
		return wasteHour;
	}

	public void setWasteHour(Integer wasteHour) {
		this.wasteHour = wasteHour;
	}

	public Integer getWasteMaterialMoney() {
		return wasteMaterialMoney;
	}

	public void setWasteMaterialMoney(Integer wasteMaterialMoney) {
		this.wasteMaterialMoney = wasteMaterialMoney;
	}

	public Integer getWasteWorkMoney() {
		return wasteWorkMoney;
	}

	public void setWasteWorkMoney(Integer wasteWorkMoney) {
		this.wasteWorkMoney = wasteWorkMoney;
	}

	public String getDefectReason() {
		return defectReason;
	}

	public void setDefectReason(String defectReason) {
		this.defectReason = defectReason;
	}

	public String getCheckerUid() {
		return checkerUid;
	}

	public void setCheckerUid(String checkerUid) {
		this.checkerUid = checkerUid;
	}

	public Employee getChecker() {
		return checker;
	}

	public void setChecker(Employee checker) {
		this.checker = checker;
	}

	public Integer getRejectBillState() {
		return rejectBillState;
	}

	public void setRejectBillState(Integer rejectBillState) {
		this.rejectBillState = rejectBillState;
	}

	public Integer getIsInBulk() {
		return isInBulk;
	}

	public void setIsInBulk(Integer isInBulk) {
		this.isInBulk = isInBulk;
	}

	public String getDeptUid() {
		return deptUid;
	}

	public void setDeptUid(String deptUid) {
		this.deptUid = deptUid;
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}

	public String getAttatchRef() {
		return attatchRef;
	}

	public void setAttatchRef(String attatchRef) {
		this.attatchRef = attatchRef;
	}

	public Date getCheckTime() {
		return checkTime;
	}

	public void setCheckTime(Date checkTime) {
		this.checkTime = checkTime;
	}

	public Boolean getIsInEffect() {
		return isInEffect;
	}
	public void setIsInEffect(Boolean isInEffect) {
		this.isInEffect = isInEffect;
	}

	public String getMaterialUid() {
		return materialUid;
	}

	public void setMaterialUid(String materialUid) {
		this.materialUid = materialUid;
	}

	public String getCreatorUid() {
		return creatorUid;
	}

	public void setCreatorUid(String creatorUid) {
		this.creatorUid = creatorUid;
	}

	public Float getTotalTaskWork() {
		return totalTaskWork;
	}

	public void setTotalTaskWork(Float totalTaskWork) {
		this.totalTaskWork = totalTaskWork;
	}

	public Float getFeePerHour() {
		return feePerHour;
	}

	public void setFeePerHour(Float feePerHour) {
		this.feePerHour = feePerHour;
	}

	public Float getMaterialFeePerPiece() {
		return materialFeePerPiece;
	}

	public void setMaterialFeePerPiece(Float materialFeePerPiece) {
		this.materialFeePerPiece = materialFeePerPiece;
	}

	public Float getLoseSemifinishedProductFee() {
		return loseSemifinishedProductFee;
	}

	public void setLoseSemifinishedProductFee(Float loseSemifinishedProductFee) {
		this.loseSemifinishedProductFee = loseSemifinishedProductFee;
	}

	public Float getTotalLoseAmount() {
		return totalLoseAmount;
	}

	public void setTotalLoseAmount(Float totalLoseAmount) {
		this.totalLoseAmount = totalLoseAmount;
	}

	public List<RejectDetail> getRejectDetails() {
		return rejectDetails;
	}

	public void setRejectDetails(List<RejectDetail> rejectDetails) {
		this.rejectDetails = rejectDetails;
	}
	

}
